package net.bolue.sysmng.tblbean;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * 数据库资源
 * @author Administrator
 *
 */
public class DbRes extends TableBean{

	/**
	 * 数据库标识
	 */
	private String dbResId;
	
	/**
	 * 数据库描述
	 */
	private String dbResDesc;
	
	/**
	 * 数据库类型
	 * 1mysql,2oracle
	 */
	private Integer dbType;
	
	/**
	 * 连接类型
	 * 1数据源连接,2配置文件连接
	 */
	private Integer connType;
	
	/**
	 * 数据库连接驱动
	 */
	private String dbDriver;
	
	/**
	 * 数据库连接url
	 */
	private String dbUrl;
	
	/**
	 * 数据库用户名
	 */
	private String dbUser;
	
	/**
	 * 数据库密码
	 */
	private String passwd;
	
	/**
	 * 说明
	 */
	private String remark;

	public String getDbResId() {
		return dbResId;
	}

	public void setDbResId(String dbResId) {
		this.dbResId = dbResId;
	}

	public String getDbResDesc() {
		return dbResDesc;
	}

	public void setDbResDesc(String dbResDesc) {
		this.dbResDesc = dbResDesc;
	}

	public Integer getDbType() {
		return dbType;
	}

	public void setDbType(Integer dbType) {
		this.dbType = dbType;
	}

	public Integer getConnType() {
		return connType;
	}

	public void setConnType(Integer connType) {
		this.connType = connType;
	}

	public String getDbDriver() {
		return dbDriver;
	}

	public void setDbDriver(String dbDriver) {
		this.dbDriver = dbDriver;
	}

	public String getDbUrl() {
		return dbUrl;
	}

	public void setDbUrl(String dbUrl) {
		this.dbUrl = dbUrl;
	}

	public String getDbUser() {
		return dbUser;
	}

	public void setDbUser(String dbUser) {
		this.dbUser = dbUser;
	}

	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Override
	public DbRes mapToEntry(Map<String,Object> map){
		DbRes dbRes = new DbRes();
		Set<String> keySet = map.keySet();
		Iterator<String> keyIt = keySet.iterator();
		while(keyIt.hasNext()){
			String key = keyIt.next();
			Object o = map.get(key);
			if("DBRESID".equals(key)){
				dbRes.setDbResId((String)o);
			} else if("DBRESDESC".equals(key)){
				dbRes.setDbResDesc((String)o);
			} else if("DBTYPE".equals(key)){
				dbRes.setDbType((Integer)o);
			} else if("CONNTYPE".equals(key)){
				dbRes.setConnType((Integer)o);
			} else if("DRIVER".equals(key)){
				dbRes.setDbDriver((String)o);
			} else if("DBURL".equals(key)){
				dbRes.setDbUrl((String)o);
			} else if("DBUSER".equals(key)){
				dbRes.setDbUser((String)o);
			} else if("PASSWD".equals(key)){
				dbRes.setPasswd((String)o);
			} else if("REMARK".equals(key)){
				dbRes.setRemark((String)o);
			}
		}
		return dbRes;
	}

	@Override
	public String keyProps() {
		return "DBRESID";
	}
	
}
